xquery version "1.0";

declare variable $recipeDetailXMLDocPath external;
declare variable $recipeId external;


declare function local:getDishList() as element()*{
	let $recipeDetailList := doc($recipeDetailXMLDocPath)//RecipeDetail
	for $recipeDetail in $recipeDetailList
	where $recipeDetail/@id = $recipeId
	return $recipeDetail//Dish
};

let $dishList := local:getDishList()
for $dish in $dishList
return <Dish id='{$dish/@id}'>{$dish/name} {$dish/calo} {$dish/cookingName} {$dish/Description} {$dish/imgPath}</Dish>


